import React from 'react';
import { DatePicker, message } from 'antd';

export default class App extends React.Component{
  getInitialState() {
    return {
      date: undefined
    };
  };

constructor(props) {
    super(props);
    this.state = {date: props.defaultValue};

  }

  handleChange(value) {
    message.info('您选择的日期是: ' + value.toString());
    this.setState({
      date: value
    });
  };

  render() {
    return <div style={{width: 400, margin: '100px auto'}}>
      <DatePicker onChange={this.handleChange} />
      <div style={{marginTop: 20}}>当前日期：{this.state.date.toString()}</div>
    </div>;
  };
}


App.propTypes = { defaultValue: React.PropTypes.string };
App.defaultProps = { defaultValue: '2015-01-20' };